package com.taxshare.seller.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.response.beans.Response;
import com.taxshare.seller.entity.AlsDocumentDetailEntity;
import com.taxshare.seller.entity.AlsDocumentEntity;
import com.taxshare.seller.service.AlsDocumentService;
import com.taxshare.seller.view.dto.AlsDocumentDTO;
import com.taxshare.seller.view.dto.AlsDocumentQueryDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author YANG
 * @date 2021/6/21
 */
@RestController
@RequestMapping("/alsDocument")
@Api(tags = "同步ALS单据信息")
public class AlsDocumentController {

    @Autowired
    AlsDocumentService alsDocumentService;

    @ApiOperation(value = "同步ALS单据信息", notes = "ALS接口")
    @PostMapping("/syncAlsDocument")
    public Response syncAlsDocument(@RequestBody AlsDocumentDTO alsDocumentDTO) {
        return alsDocumentService.syncAlsDocument(alsDocumentDTO);
    }

    @PostMapping("/query")
    @ApiOperation(value = "订单列表", notes = "同步Als单据信息")
    public Response<IPage<AlsDocumentEntity>> queryAlsDocument(@RequestBody PageRequest<AlsDocumentQueryDTO> query) {
        return alsDocumentService.queryAlsDocument(query);
    }

    @PostMapping("/queryDetail")
    @ApiOperation(value = "订单明细查询", notes = "同步Als单据信息")
    public Response<List<AlsDocumentDetailEntity>> queryAlsDetail(@RequestParam String docId) {
        return alsDocumentService.queryAlsDetail(docId);
    }
}
